
program uni_sub(sub,tstnum)

!       Handler code for err_hand:
!  bit 7
!  bit 6
!  bit 5 set = display addr,data block
!  bit 4 set = display mask_tied as data
!  bit 3 set = display mask as data
!  bit 2 set = display mask as addr
!  bit 1 set = display data
!  bit 0 set = display read data

handle bus_addr_high_tied(mask,access_attempted,addr)
  declare
        string mask
        string access_attempted
        numeric addr
        string flt = "(1) addr line/s may be stuck high"
  end declare
  err_hand(flt,$22,mask,"",access_attempted,addr,0,0)
  abort ("failed")
end handle

handle bus_addr_low_tied(mask,access_attempted,addr)
  declare
        string mask
        string access_attempted
        numeric addr
        string flt = "(2) addr line/s may be stuck low"
  end declare
  err_hand(flt,$22,mask,"",access_attempted,addr,0,0)
  abort ("failed")
end handle

handle bus_addr_tied(mask,access_attempted,addr,data)
  declare
        string mask
        string access_attempted
        numeric addr
        numeric data
        string flt = "(3) addr lines may be tied"
  end declare
  err_hand(flt,$26,mask,"",access_attempted,addr,0,data)
  abort ("failed")
end handle

handle bus_data_high_tied(mask)
  declare
        string mask
        string flt = "(4) data line/s may be stuck high"
  end declare
  err_hand(flt,$8,mask,"","",0,0,0)
  abort ("failed")
end handle

handle bus_data_low_tied(mask)
  declare
        string mask
        string flt = "(5) data line/s may be stuck low"
  end declare
  err_hand(flt,$8,mask,"","",0,0,0)
  abort ("failed")
end handle

handle bus_data_tied(mask)
  declare
        string mask
        string flt = "(6) data lines may be tied"
  end declare
  err_hand(flt,$8,mask,"","",0,0,0)
  abort ("failed")
end handle

handle generic_fault(message)
  declare
        string message
        string flt = "(8) generic_fault"
  end declare
  err_hand2(flt,message,$0,"","",0)
  abort ("failed")
end handle

handle m_bus_addr_high(mask)
  declare
        string mask
        string flt = "(13) addr line/s was high, expected low"
  end declare
  err_hand(flt,$4,mask,"","",0,0,0)
  abort ("failed")
end handle

handle m_bus_addr_low(mask)
  declare
        string mask
        string flt = "(14) addr line/s was low, expected high"
  end declare
  err_hand(flt,$4,mask,"","",0,0,0)
  abort ("failed")
end handle

handle m_bus_kernel(message1,message2)
  declare
        string message1
        string message2
        string flt = "(15) "
  end declare
  flt = flt + message1
  err_hand2(flt,message2,$0,"","",0)
  abort ("failed")
end handle

handle m_pod_no_reset(message1,message2)
  declare
        string message1
        string message2
        string flt = "(17) "
  end declare
  flt = flt + message1
  err_hand2(flt,message2,$0,"","",0)
  abort ("failed")
end handle

handle m_pod_slow_clock
  declare
        string flt = "(21) UUT clock slow or stuck"
  end declare
  err_hand2(flt,"",$0,"","",0)
  abort ("failed")
end handle

handle m_pod_stopped
  declare
        string flt = "(22) microprocessor stopped or bad"
  end declare
  err_hand2(flt,"",$0,"","",0)
  abort ("failed")
end handle

handle pod_addr_tied(mask,access_attempted,addr,data)
  declare
        string flt = "(23) addr line/s may not be drivable"
        string mask
        string access_attempted
        numeric addr
        numeric data
  end declare
  err_hand(flt,$36,mask,"",access_attempted,addr,data,0)
  abort ("failed")
end handle

handle pod_breakpoint
  declare
        string flt = "(24) breakpoint reached"
  end declare
  err_hand2(flt,"",$0,"","",0)
  abort ("failed")
end handle

handle pod_ctl_tied(mask,access_attempted,addr)
  declare
        string mask
        string access_attempted
        numeric addr
        string flt = "(25) control line/s may not be drivable"
  end declare
  err_hand2(flt,"",$90,mask,access_attempted,addr)
  abort ("failed")
end handle

handle pod_data_incorrect (access_attempted,addr,data_expected,data)
  declare
        string flt = "(26) read incorrect data"
        string access_attempted
        numeric addr
        numeric data_expected
        numeric data
  end declare
  err_hand(flt,$23,"","",access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle pod_data_tied (mask,access_attempted,addr)
  declare
        string flt = "(27) data line/s may not be drivable"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$28,mask,"",access_attempted,addr,0,0)
  abort ("failed")
end handle

handle pod_forcing_active (mask,access_attempted,addr)
  declare
        string mask
        string access_attempted
        numeric addr
        string flt = "(28) forcing signal/s may be active"
  end declare
  err_hand2(flt,"",$30,mask,access_attempted,addr)
  abort ("failed")
end handle

handle pod_interrupt_active (mask,access_attempted,addr)
  declare
        string mask
        string access_attempted
        numeric addr
        string flt = "(29) interrupt signal/s may be active"
  end declare
  err_hand2(flt,"",$50,mask,access_attempted,addr)
  abort ("failed")
end handle

handle pod_special(index,access_attempted,addr)
  declare
        numeric index
        string access_attempted
        numeric addr
        string flt
  end declare

  if (index = 0) then
        flt = "(31) LOST CONTROL OF UUT MICROPROCESSOR"
  elseif (index = 1) then
        flt = "(31) UUT HAD AN INTERRUPT OR EXCEPTION"
  elseif (index = 2) then
        flt = "(31) INTERNAL COMMAND ERROR"
  elseif (index = 3) then
        flt = "(31) INTERNAL ADDRESS ERROR"
  elseif (index = 4) then
        flt = "(31) UUT WAS RESET"
  elseif (index = 7) then
        flt = "(31) UUT MICROPROCESSOR HALTED"
  else
        flt = "(31) SYSTEM PROBLEM"
  endif
!  err_hand(flt,$20,"","",access_attempted,addr,0,0)
  err_hand(flt,$0,"","","",0,0,0)
  abort ("failed")
end handle

handle pod_timeout_bad_pwr
  declare
        string flt = "(32) pod timeout, bad UUT power"
  end declare
  err_hand2(flt,"",$0,"","",0)
  abort ("failed")
end handle

handle pod_timeout_no_clk
  declare
        string flt = "(34) pod timeout, bad UUT clock"
  end declare
  err_hand2(flt,"",$0,"","",0)
  abort ("failed")
end handle

handle ram_addr_addr_tied (mask,access_attempted,addr)
  declare
        string flt = "(39) addr lines may be tied together"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$24,mask,mask,access_attempted,addr,0,0)
  abort ("failed")
end handle

handle ram_addr_data_tied (mask,mask_tied,access_attempted,addr,data_expected,data)
  declare
        string flt = "(40)addr line/s may be tied to data line/s"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$37,mask,mask_tied,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_addr_data_tied_unconfirmed (mask,mask_tied,access_attempted,addr,data_expected,data)
  declare
        string flt = "(41) addr line/s may be tied to data line/s"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$37,mask,mask_tied,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_addr_fault (mask,access_attempted,addr)
  declare
        string flt = "(42) addr line/s may be stuck or open"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$24,mask,mask,access_attempted,addr,0,0)
  abort ("failed")
end handle

handle ram_cell_cell_tied (mask,access_attempted,addr,data_expected,data)
  declare
        string flt = "(43) memory cell may be coupled to memory cell"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$2B,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_cell_high_tied (mask,access_attempted,addr,data_expected,data)
  declare
        string flt = "(44) memory cell/s may be stuck high"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$2B,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_cell_low_tied (mask,access_attempted,addr,data_expected,data)
  declare
        string flt = "(45) memory cell/s may be stuck low"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$2B,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_data_data_tied (mask,access_attempted,addr,data_expected,data)
  declare
        string flt = "(46) data line/s may be tied to data line/s"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$2B,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_data_fault (access_attempted,addr,data)
  declare
        string flt = "(47) cannot modify RAM data"
        string mask = ""
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$21,mask,mask,access_attempted,addr,0,data)
  abort ("failed")
end handle

handle ram_data_high_tied (mask,access_attempted,addr,data_expected,data)
  declare
        string flt = "(48) data line/s may be stuck high"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$2B,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_data_incorrect (access_attempted,addr,data_expected,data)
  declare
        string flt = "(49) read incorrect data"
        string mask = ""
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$23,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_data_low_tied (mask,access_attempted,addr,data_expected,data)
  declare
        string flt = "(50) data line/s may be stuck low"
        string mask
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$2B,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

handle ram_data_retention_fault (access_attempted,addr,data_expected,data)
  declare
        string flt = "(51) RAM data retention fault (bad refresh?)"
        string mask = ""
        string access_attempted
        numeric addr
  end declare
  err_hand(flt,$23,mask,mask,access_attempted,addr,data_expected,data)
  abort ("failed")
end handle

!********************************************************************

  declare
        numeric sub
        numeric tstnum
        string tst_result
  end declare

!******************  for show only  *****************
tst_result = "PASSED"
!****************************************************

  if (sub = 0) then                     !main menu selection
    if(tstnum = 1) then
      tst_result = uni_io1()
    elseif (tstnum = 2) then
      tst_result = uni_prbe()
    elseif (tstnum = 3) then
!      tst_result = uni_ctl1()
    elseif (tstnum = 4) then
!      tst_result = uni_ctl2()
    elseif (tstnum = 5) then
!      tst_result = "@-00-03"            !call dram sub menu
    elseif (tstnum = 6) then
!      tst_result = "@-04-02"            !call yammu sub menu
    elseif (tstnum = 7) then
!      tst_result = clb_cbus()
    elseif (tstnum = 8) then
!      tst_result = "@-07-03"            !call tbus sub menu
    elseif (tstnum = 9) then
!      tst_result = "@-11-03"            !call iop sub menu
    elseif (tstnum = 10) then
      tst_result = clb_intr()
    elseif (tstnum = 11) then
!      tst_result = clb_sync()
    elseif (tstnum = 12) then
!      tst_result = clb_batt()
    endif
!---------------------------------------
  else                                  !sub test selections below
    if(tstnum = 1) then
!      tst_result = clb_dram()
    elseif (tstnum = 2) then
!      tst_result = clb_pari()
    elseif (tstnum = 3) then
!      tst_result = clb_relo()
    elseif (tstnum = 4) then
!      tst_result = ()          !return statement
    elseif (tstnum = 5) then
!      tst_result = clb_yamr()
    elseif (tstnum = 6) then
!      tst_result = clb_yamf()
    elseif (tstnum = 7) then
!      tst_result = ()          !return statement
    elseif (tstnum = 8) then
!      tst_result = clb_tsi()
    elseif (tstnum = 9) then
!      tst_result = clb_tbus()
    elseif (tstnum = 10) then
      tst_result = clb_tdma()
    elseif (tstnum = 11) then
!      tst_result = ()          !return statement
    elseif (tstnum = 12) then
!      tst_result = iop_freq()
    elseif (tstnum = 13) then
!      tst_result = iop_wrt()
    elseif (tstnum = 14) then
!      tst_result = iop_read()
    elseif (tstnum = 14) then
!      tst_result = ()          !return statement
    endif
  endif

  return (tst_result)

end program

